#include <iostream>
#include "common/be_image.h"
#include "texturestore.h"

Texturestore* Texturestore::Instance() 
{
	static Texturestore t;
	return &t;
}

boost::shared_ptr<BeImageTexture2D> Texturestore::load(const std::string& filename)
{
// 	cerr << "checking '" << filename << "'" << endl;
	if ( m_textureImageMap[filename] )
	{
// 		cerr << "texture '" << filename << "' is present" << endl;
		return m_textureImageMap[filename];
	}
	else
	{
		boost::shared_ptr<BeImageTexture2D> t( new BeImageTexture2D(filename.c_str()) );
		m_textureImageMap[filename]=t;
		return t;
	}
}


